﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Zeus.Domain.MySql.Service;
using Zeus.Domain.MySql.Contract;
using Zeus.Components.Nopi.Excel;
using Zeus.Thunder.Web.DataExporter;

namespace Zeus.Thunder.Web.Controllers
{
    public class ModelViewController : Controller
    {
        public ActionResult PassModel()
        {
            CustomerService service = new CustomerService();
            CustomerResponse response = service.GetCustomerResponse();
            
            return View("/Views/AspMvc/ModelView/GetCustomers.cshtml", response);
        }

        public FileStreamResult GetFileStream()
        {
            MemoryStream stream = null;
            string contentType = "application/vnd.ms-excel";
            string fileName = "testFile2.xls";

            NopiExcelWriter writer = new SampleExcelWriter("Test Sheet2");
            stream = writer.WriteToMemoryStream();

            return File(stream, contentType, fileName);
        }
    }
}
